export default {
    visitorsOptions: [
        { "label": "2000以下", "value": "1" },
        { "label": "5000以下", "value": "2" },
        { "label": "1万以下", "value": "3" },
        { "label": "1万-10万", "value": "4" },
        { "label": "10万-100万", "value": "5" },
        { "label": "100万-1000万", "value": "6" },
        { "label": "1000万以上", "value": "7" },
    ],
    
    //平台类型
    adtypeOptions: [
        { "label": "PC", "value": "1" }, 
        { "label": "移动网页",  "value": "2" }, 
        { "label": "APP应用", "value": "3" }
    ],
    placeTypeKeyValue:{
        "1": "嵌入", "2":"悬浮","3":"开屏","4":"信息流"
    },
    priceUnit: {
         "1": '', "2": '元/每天', "3": '元/千次展现', "4": '元/单次点击'
    },
    filter_adtype(value) {
        var label = 'PC';
        for (var i in Options.adtypeOptions) {
            if (Options.adtypeOptions[i]['value'] == value) {
                label = Options.adtypeOptions[i].label;
            }
        }
        return label;
    },
    filter_placeType(value) {
        if (Options.placeTypeKeyValue[  value  ]){
            return Options.placeTypeKeyValue[  value  ];
        }
        return '-';
    },
    // 计费方式
    caculateMethod:{
        "1": "CPD","2":"CPM","3":"CPC"
    },
    filter_caculateMethod(value){
        if (Options.caculateMethod[value]) {
            return Options.caculateMethod[value];
        }
        return '-';
    },
   // 广告物料的
    filter_disabled(value) {
        var option = { 0: "有效", 1: "禁用" }
        if (option[value]) {
            return option[value]
        }
        return value;
    },
    filter_medias_type(value) {
        var name = {
             "txt": "文字", 
             "html": "富媒体",
              "image": "图片",
         "flash": "Flash", 
         "video": "视频", "stream":"信息流" 
        };
        if (name[value]) {
            return name[value]
        }
        return value;
    },
    // 物料的select搜索类型
    mediasOptions: [{
        "label": "全部",
        "value": "0"
    }, {
        "label": "文字",
        "value": "txt"
    }, {
        "label": "图片",
        "value": 'image'
    }, {
        "label": "Flash",
        "value": "flash"
    }, {
        "label": "富媒体",
        "value": "html"
    }, {
        "label": "视频",
        "value": "video"
        }, {
            "label": "信息流",
            "value": "stream"
        }], 

    filter_medias_content(content) {
        if (!content) return '--';
        var type = content['type'] || '';
        if (type == 'image') {
            return content[type][0]['url'];

        }

        if (type == 'txt') {
            var style = "";
            for (var k in content['style']) {
                style += k + ":" + content['style'][k] + ";";
            }
            return '<div class="creative-preview-text" style="' + style + '">  </div>'

        }
        if (type == 'html') {
            return '<div class="creative-preview-rich">  </div>'
        }
        if (type == 'flash') {
            return '<div class="creative-preview-flash">  </div>'
        }
        if (type == 'video') {
            return '<div class="creative-preview-video">  </div>'
        }
    },
}